package com.syncomponents.convert;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;

/**
 * 消息转换基类
 * 
 * @author sunkey
 * @date Jan 17, 2014
 */
public abstract class AbstractMessageConvert<E> implements IMessageConvert<E>, InitializingBean {

    protected static final Logger LOGGER = LoggerFactory.getLogger(AbstractMessageConvert.class);

    private String beanName;

    @Override
    public void afterPropertiesSet() throws Exception {
        getMessageConvertContainer().registerMessageConverter(getPlatformType().getValue(), this);
    }

    public abstract IMessageConvertContainer getMessageConvertContainer();

    public abstract PlatformType getPlatformType();

    @Override
    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }

    public String getBeanName() {
        return beanName;
    }

}
